﻿<UserControl x:Class="YATE.AddTable"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:cc="clr-namespace:YATE"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:YATE"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             Name="UC"
             Margin="0,1"
             Cursor="Hand"
             d:DesignHeight="24"
             d:DesignWidth="24"
             mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Style/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="ButtonFocusVisual1">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Rectangle Margin="3"
                                       SnapsToDevicePixels="true"
                                       Stroke="Black"
                                       StrokeDashArray="1 2"
                                       StrokeThickness="1" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <LinearGradientBrush x:Key="ButtonNormalBackgroundFill1" StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Offset="0" Color="#FFFFFFFF" />
                <GradientStop Offset="0.9" Color="#FFF0F0EA" />
            </LinearGradientBrush>
            <Style x:Key="ButtonFocusVisual">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Rectangle Margin="3"
                                       SnapsToDevicePixels="true"
                                       Stroke="Black"
                                       StrokeDashArray="1 2"
                                       StrokeThickness="1" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <LinearGradientBrush x:Key="ButtonNormalBackgroundFill" StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Offset="0" Color="#EDEDED" />
                <GradientStop Offset="0.9" Color="#EDEDED" />
            </LinearGradientBrush>


            <LinearGradientBrush x:Key="morecolorgradientbrush" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Offset="0.1" Color="Orange" />
                <GradientStop Offset=".9" Color="White" />
            </LinearGradientBrush>

            <Style x:Key="ColorButtonStyle" TargetType="{x:Type Button}">
                <Setter Property="HorizontalContentAlignment" Value="Center" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Border x:Name="buttonBorder"
                                    Width="15"
                                    Height="15"
                                    Margin="0"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="1" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>


            <Style x:Key="moreColorsLabel" TargetType="{x:Type Label}">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="Padding" Value="5" />
                <Setter Property="HorizontalContentAlignment" Value="Left" />
                <Setter Property="VerticalContentAlignment" Value="Top" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Label}">
                            <Border Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Padding="{TemplateBinding Padding}"
                                    SnapsToDevicePixels="true">
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  RecognizesAccessKey="True"
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter Property="Background" Value="{StaticResource morecolorgradientbrush}" />
                                    <Setter Property="BorderThickness" Value="1" />
                                    <Setter Property="BorderBrush" Value="Green" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <LinearGradientBrush x:Key="ButtonNormalBackgroundFill2" StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Offset="0" Color="#FFFFFFFF" />
                <GradientStop Offset="0.9" Color="#FFF0F0EA" />
            </LinearGradientBrush>
            <SolidColorBrush x:Key="ButtonBorder" Color="#FF003C74" />
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>

        <ToggleButton x:Name="AddTableButton"
                      Width="25"
                      Height="25"
                      Margin="0"
                      HorizontalAlignment="Stretch"
                      HorizontalContentAlignment="Stretch"
                      VerticalContentAlignment="Stretch"
                      Checked="AddTableButton_Checked"
                      IsChecked="False"
                      Padding="0.5"
                      Style="{DynamicResource CMToogleButton_WhiteBack}">

            <Grid HorizontalAlignment="Stretch">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="24" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="24" />
                </Grid.RowDefinitions>
                <Rectangle Grid.Column="0"
                           Width="14"
                           Height="14"
                           Margin="5,0"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Center"
                           Fill="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},
                                          Path=Foreground}">
                    <Rectangle.OpacityMask>
                        <VisualBrush Stretch="Uniform" Visual="{StaticResource appbar_table}" />
                    </Rectangle.OpacityMask>
                </Rectangle>


            </Grid>
        </ToggleButton>
        <Popup x:Name="popup"
               AllowsTransparency="True"
               Focusable="True"
               IsOpen="{Binding Path=IsChecked,
                                ElementName=AddTableButton}"
               Placement="Bottom"
               PlacementTarget="{Binding ElementName=AddTableButton}"
               PopupAnimation="Fade"
               SnapsToDevicePixels="True"
               StaysOpen="False">
            <Border BorderBrush="DarkGray" BorderThickness="0">
                <Grid Background="#FFFFFFFF">
                    <Border Background="White"
                            BorderBrush="#999999"
                            BorderThickness="1">
                        <StackPanel Background="#FFFFFFFF" Orientation="Vertical">

                            <Border Height="23"
                                    Background="#DDE7EE"
                                    BorderBrush="#BFBFBF"
                                    BorderThickness="0,0,0,2">
                                <DockPanel>
                                    <Label x:Name="lb_Name"
                                           VerticalAlignment="Center"
                                           VerticalContentAlignment="Center"
                                           Content="Insert Table"
                                           FontFamily="Arial"
                                           FontSize="11"
                                           FontWeight="Bold"
                                           Foreground="DarkBlue"
                                           SnapsToDevicePixels="True" />
                                </DockPanel>
                            </Border>
                            <StackPanel x:Name="SecondRow"
                                        Margin="2"
                                        Orientation="Horizontal"
                                        SnapsToDevicePixels="True">
                                <Grid x:Name="gd_Grid" Background="White" />

                            </StackPanel>
                        </StackPanel>
                    </Border>
                </Grid>
            </Border>
        </Popup>
    </Grid>
</UserControl>


